//自定义退出码

#include <stdio.h>

enum     //匿名枚举类型
{
    Success = 0,
    Div_zero,
    Mod_zero  //模0
} exit_code = Success;

int Div(int a, int b)
{
    if (0 == b)
    {
        exit_code = Div_zero;//异常时的退出码;  因为没有真正异常(/0), 所以退出码还是有用的
        return -1;
    }
    return a / b;
}

const char* CodeToErrString(int code)
{
    switch (code)
    {
        case Success:
            return "Success";
        case Div_zero:
            return "Div_zero";
        case Mod_zero:
            return "Mod_zero";
        default:
            return "unknow error";
    }
}


int main()
{
    int a=0, b=0;
    scanf("%d %d", &a, &b);
    int result = Div(a, b);
    printf("result: %d, [%s]\n", result, CodeToErrString(exit_code));

    return exit_code;
}
